package com.zhanglijie.improve.collections.delayqueue.demo.timecache;

import java.util.concurrent.TimeUnit;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/12/4 0004 21:17
 */
public class TestTimeCache {
    public static void main(String[] args) throws InterruptedException {
        TimeCache<Integer, String> cache = new TimeCache<>();
        cache.put(1,"1",5, TimeUnit.SECONDS);
        Thread.sleep(2000);
        System.out.println(cache.get(1)==null?"过期了":cache.get(1));
        Thread.sleep(4000);
        System.out.println(cache.get(1)==null?"过期了":cache.get(1));
    }
}
